#include <typescommon.h>
#include <queObj.h>
#include <genrand.h>

struct ckQOT_Struct
{
    uint64_t wgval;
    uint64_t valTime;
    uint8_t valtype;
    uint8_t usrdata[5];
};
#define QUEUE_QOT_OBJECT_NUMB 10
#define QUE_READ_CHEANAL 1

int main(int argc, char **argv)
{
    static uint8_t tmpQue[queObjCalcTotal(QUEUE_QOT_OBJECT_NUMB, sizeof(struct ckQOT_Struct))];
    queObjInit(tmpQue, sizeof(tmpQue), sizeof(struct ckQOT_Struct));
    struct ckQOT_Struct tmpqot;
    for (int i = 0; i < 8; i++)
    {
        tmpqot = (struct ckQOT_Struct){.wgval = 1000 + i, .valTime = 100 + i, .valtype = 1};
        queObjWrite(tmpQue, &tmpqot);
        tmpqot = (struct ckQOT_Struct){.wgval = 2000 + i, .valTime = 200 + i, .valtype = 1};
        queObjWrite(tmpQue, &tmpqot);
        queObjRead(tmpQue, &tmpqot, QUE_READ_CHEANAL);
        logdebug("read:%ld,%ld", tmpqot.wgval, tmpqot.valTime);
    }

    while (queObjRead(tmpQue, &tmpqot, QUE_READ_CHEANAL) > 0)
    {
        logdebug("read:%ld,%ld", tmpqot.wgval, tmpqot.valTime);
    }

    return 1;
}
